package com.dubbo.consumer;

import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ConsumerConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author Jack
 * @description: TODO
 * @date 2021/11/3 18:28
 */
@Configuration
@EnableDubbo(scanBasePackages = "com.dubbo.consumer")
@ComponentScan(value = {"com.dubbo.consumer"})
public class Consumerconfiguration {
    @Bean
    public ApplicationConfig applicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName("demo-consumer");
        return applicationConfig;
    }
    @Bean
    public ConsumerConfig consumerConfig(){
        return new ConsumerConfig();
    }


    @Bean
    public RegistryConfig registryConfig() {
        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("112.125.89.33");
        registryConfig.setPort(2181);
        registryConfig.setProtocol("zookeeper");
        registryConfig.setTimeout(10000);
        return registryConfig;

    }
}
